Skip to content

Conversation

@ivoanjo
Copy link
Member

@ivoanjo ivoanjo commented Nov 5, 2024

What does this PR do?

This PR fixes a profiler flaky spec from
https://app.circleci.com/pipelines/github/DataDog/dd-trace-rb/17279/workflows/bafa8b55-7fee-414f-8875-c7a8ef8b56dd/jobs/615562 :

  1) Datadog::Profiling::Collectors::CpuAndWallTimeWorker#start Process::Waiter crash regression tests can sample an instance of Process::Waiter without crashing
     Failure/Error: expect(sample.locations.first.path).to eq "In native code"

     NoMethodError:
       undefined method `locations' for nil

The fix in this case is to make sure that we keep running the profiler until we observe a sample for the thread we expect, not just for any thread.

Motivation:

We aim to always have zero flaky specs in the profiler.

Change log entry

(No entry needed for this one)

Additional Notes:

If for some reason we're not able to sample the target thread, the test will still correctly fail (with the try_wait_until failing).

Fixes https://github.com/datadog/ruby-guild/issues/182

How to test the change?

Validate that CI is still green :)

**What does this PR do?**

This PR fixes a profiler flaky spec from
https://app.circleci.com/pipelines/github/DataDog/dd-trace-rb/17279/workflows/bafa8b55-7fee-414f-8875-c7a8ef8b56dd/jobs/615562 :

```
  1) Datadog::Profiling::Collectors::CpuAndWallTimeWorker#start Process::Waiter crash regression tests can sample an instance of Process::Waiter without crashing
     Failure/Error: expect(sample.locations.first.path).to eq "In native code"

     NoMethodError:
       undefined method `locations' for nil
```

The fix in this case is to make sure that we keep running the profiler
until we observe a sample for the thread we expect, not just for
any thread.

**Motivation:**

We aim to always have zero flaky specs in the profiler.

**Additional Notes:**

If for some reason we're not able to sample the target thread,
the test will still correctly fail (with the `try_wait_until` failing).

Fixes DataDog/ruby-guild#182

**How to test the change?**

Validate that CI is still green :)
@ivoanjo ivoanjo requested a review from a team as a code owner November 5, 2024 16:30
@github-actions github-actions bot added the dev/testing Involves testing processes (e.g. RSpec) label Nov 5, 2024
@ivoanjo ivoanjo added profiling Involves Datadog profiling dev/internal Other internal work that does not need to be included in the changelog labels Nov 5, 2024
@codecov-commenter
Copy link

codecov-commenter commented Nov 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.72%. Comparing base (3e73b3b) to head (5d0390d).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4072      +/-   ##
==========================================
- Coverage   97.72%   97.72%   -0.01%     
==========================================
  Files        1338     1338              
  Lines       80248    80248              
  Branches     4016     4016              
==========================================
- Hits        78426    78421       -5     
- Misses       1822     1827       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@pr-commenter
Copy link

pr-commenter bot commented Nov 5, 2024

Benchmarks

Benchmark execution time: 2024-11-06 09:01:57

Comparing candidate commit 5d0390d in PR branch ivoanjo/fix-flaky-profiler-spec with baseline commit 3e73b3b in branch master.

Found 0 performance improvements and 1 performance regressions! Performance is the same for 28 metrics, 2 unstable metrics.

scenario:profiler - stack collector

  • 🟥 throughput [-166.895op/s; -165.286op/s] or [-5.764%; -5.709%]

@ivoanjo ivoanjo enabled auto-merge November 6, 2024 08:23
@ivoanjo ivoanjo requested a review from AlexJF November 6, 2024 09:07
@ivoanjo ivoanjo merged commit 8f4472b into master Nov 6, 2024
270 checks passed
@ivoanjo ivoanjo deleted the ivoanjo/fix-flaky-profiler-spec branch November 6, 2024 09:56
@github-actions github-actions bot added this to the 2.6.0 milestone Nov 6, 2024
ivoanjo added a commit that referenced this pull request Nov 6, 2024
**What does this PR do?**

This PR relaxes the GitHub `CODEOWNERS` file rules for things related
to profiling.

Specifically, it adds `@DataDog/ruby-guild` as a second owner on
top of just `@DataDog/profiling-rb`.

**Motivation:**

Now that we've enableed the "Require review from Code Owners" feature
on GitHub, since there's not a lot of us working on profiling, it
hasn't worked very well.

Specifically, for very small PRs (#4072 is a good example where we
slightly tweaked a test to avoid flakiness), it's annoying to have
to wait for a very small reviewer pool, when most folks that
are on the Ruby guild can help out review such changes.

**Additional Notes:**

N/A

**How to test the change?**

Check that future PRs affecting profiling can be merged with a
review from anyone on the ruby-guild team.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dev/internal Other internal work that does not need to be included in the changelog dev/testing Involves testing processes (e.g. RSpec) profiling Involves Datadog profiling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants